package com.publiccms.views.directive.tools;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.sanluan.common.base.BaseDirective;
import com.sanluan.common.handler.RenderHandler;

@Component
public class MemoryDirective extends BaseDirective {

	@Override
	public void execute(RenderHandler handler) throws IOException, Exception {
		Map<String, Long> map = new HashMap<String,Long>();
		map.put("free", Runtime.getRuntime().freeMemory());
		map.put("total", Runtime.getRuntime().totalMemory());
		map.put("max", Runtime.getRuntime().maxMemory());
		handler.put("object", map).render();
	}
}
